#include <stdio.h>
#include <stdlib.h>

int* twoSum(int* nums, int numsSize, int target, int* returnSize)
{
    int *num = (int*)malloc(sizeof(int)*2);
    for(int i = 0; i < numsSize - 1; i++)
    {
        for(int j = i + 1; j < numsSize; j++)
        {
            if(nums[i] + nums[j] == target)
            {
                num[0] = i;
                num[1] = j;
                *returnSize = 2;
                return num;
            }
        }
    }
    return NULL;
}

int main() 
{
    int nums[] = {2, 7, 11, 15};
    int target = 9;
    int returnSize;
    int* result = twoSum(nums, 4, target, &returnSize);
    if (result != NULL) 
    {
        printf("Indices: %d, %d\n", result[0], result[1]);
        free(result);
    } 
    else 
    {
        printf("No result found\n");
    }
    return 0;
}
